<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class AddFsCompanyIdToCruiseTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('cruise_check_rectify', function (Blueprint $table) {
            $table->unsignedInteger('cruiseCheckCompanyId')->default(0)->comment('巡检机构 cruise_check_company.id')->index('idx_cruiseCheckCompanyId')->after('shopId');
        });

        Schema::table('cruise_order', function (Blueprint $table) {
            $table->unsignedInteger('cruiseCheckCompanyId')->default(0)->comment('巡检机构 cruise_check_company.id')->index('idx_cruiseCheckCompanyId')->after('shopId');
        });

        Schema::table('cruise_check_task_groups', function (Blueprint $table) {
            $table->json('beCruiseCheckCompanyIds')->nullable()->comment('被巡检机构json cruise_check_company.id')->after('shopIds');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('cruise_check_rectify', function (Blueprint $table) {
            $table->dropColumn('cruiseCheckCompanyId');
        });

        Schema::table('cruise_order', function (Blueprint $table) {
            $table->dropColumn('cruiseCheckCompanyId');
        });

        Schema::table('cruise_check_task_groups', function (Blueprint $table) {
            $table->dropColumn('beCruiseCheckCompanyIds');
        });
    }
}
